﻿<Window x:Class="AbhiRuchiFoods.MainWindow"
         xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:sys="clr-namespace:System;assembly=mscorlib"
        xmlns:Ribbon="clr-namespace:Microsoft.Windows.Controls.Ribbon;assembly=RibbonControlsLibrary"
        Title="AbhiRuchiFoods" WindowStartupLocation="CenterScreen" Icon="images\UserInfo.png" xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" WindowState="Maximized">
    <Window.Resources>
        <!--Height="1020" Width="1650"-->
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="/RibbonControlsLibrary;component/Themes/Office2007Blue.xaml"/>
                <!--<ResourceDictionary Source="/DataGridThemes;component/WhistlerBlue.xaml" />-->
                <!--<ResourceDictionary Source="/DataGridThemes;component/ExpressionLight.xaml" />-->
                <!--<ResourceDictionary Source="/DataGridThemes;component/ExpressionDark.xaml" />-->
            </ResourceDictionary.MergedDictionaries>
            <!-- 
         This color will be used to draw a border around the TabControl, on 
         the bottom of the TabItemPanel and on the bottom of unselected TabItems.
      -->
            <Color x:Key="BorderColor_Base">#888</Color>

            <!-- 
         This color will be used to draw the (outer) background of TabPages and
         the selected TabItem.
      -->
            <Color x:Key="TabControl_BackgroundColor_Base">#EEF7FF</Color>

            <!-- Brushes used for styling the TabControl -->
            <SolidColorBrush x:Key="TabControl_BackgroundBrush_Base" 
                       Color="{StaticResource TabControl_BackgroundColor_Base}"/>

            <!-- Brushes for drawing the outer and inner borders on TabPages -->
            <SolidColorBrush x:Key="TabPage_InnerBorderBrushDark" 
                       Color="#FF8DB2E3"/>
            <LinearGradientBrush x:Key="TabPage_InnerBorderBrushBright" 
                           StartPoint="0,0" EndPoint="1,1">
                <LinearGradientBrush.GradientStops>
                    <GradientStop Offset="0" Color="Transparent"/>
                    <GradientStop Offset="1" Color="#FFC0F9FF"/>
                </LinearGradientBrush.GradientStops>
            </LinearGradientBrush>

            <!-- 
         We only want to render a line between the TabControl's TabPage-area and
         the TabItemsPanel where there is no TabItem/TabStrip. However, we cannot
         simply set the TabItemPanel's Background-property as this would affect
         the area as a whole.
         The trick here is to define a gradient that only renders a 1px line at
         the bottom. Since TabItems are rendered above the background, this line
         will only be visible in the area that doesn't contain a TabItem.
         We'll achieve this effect by using a gradient that finishes with the
         border-color, but only for the last .01%.
      -->
            <LinearGradientBrush x:Key="TabItemPanel_BackgroundBrush" 
                           StartPoint="0,0" EndPoint="0,1">
                <LinearGradientBrush.GradientStops>
                    <GradientStop Offset="0.98" Color="Transparent"/>
                    <GradientStop Offset="0.99" 
               Color="{StaticResource BorderColor_Base}"/>
                </LinearGradientBrush.GradientStops>
            </LinearGradientBrush>

            <!-- Brushes used for styling TabItems (Background) -->
            <LinearGradientBrush x:Key="TabItem_BackgroundBrush_Disabled" 
                           StartPoint="0,0" EndPoint="0,1">
                <LinearGradientBrush.GradientStops>
                    <GradientStop Color="#EEE" Offset="0"/>
                    <GradientStop Color="#BBB" Offset="0.98"/>
                    <!-- 
               This is the same trick as with the TabItemPanel_BackgroundBrush (see there).
            -->
                    <GradientStop Color="{StaticResource BorderColor_Base}" 
                          Offset="0.99"/>
                </LinearGradientBrush.GradientStops>
            </LinearGradientBrush>
            <LinearGradientBrush x:Key="TabItem_BackgroundBrush_Selected" 
                           StartPoint="0,0" EndPoint="0,1">
                <LinearGradientBrush.GradientStops>
                    <GradientStop Color="#FFFFC14A" Offset="0.1" />
                    <GradientStop Color="{StaticResource TabControl_BackgroundColor_Base}" 
                          Offset="0.15"/>
                    <GradientStop Color="#C5DBF6" Offset="0.8"/>
                    <GradientStop Color="{StaticResource TabControl_BackgroundColor_Base}" 
                          Offset="1.0"/>
                </LinearGradientBrush.GradientStops>
            </LinearGradientBrush>
            <LinearGradientBrush x:Key="TabItem_BackgroundBrush_Unselected" 
                           StartPoint="0,0" EndPoint="0,1">
                <LinearGradientBrush.GradientStops>
                    <GradientStop Color="#E8F2FF" Offset="0.0"/>
                    <GradientStop Color="#DFE9F6" Offset="0.3"/>
                    <GradientStop Color="#C7D8EE" Offset="0.7"/>
                    <GradientStop Color="#B9CADE" Offset="0.98"/>
                    <!-- See the TabItemPanel_BackgroundBrush comment. -->
                    <GradientStop Color="{StaticResource BorderColor_Base}" 
                          Offset="0.99"/>
                </LinearGradientBrush.GradientStops>
            </LinearGradientBrush>
            <LinearGradientBrush x:Key="TabItem_HoverBackgroundBrush" 
                           EndPoint="0.5,1" StartPoint="0.5,0">
                <GradientStop Color="#FFFFD5A0" Offset="0.3" />
                <GradientStop Color="#FFFFA335" Offset="0.51" />
                <GradientStop Color="#FFFFC14A" Offset="0.98" />
            </LinearGradientBrush>

            <!-- Brushes used for styling TabItems (Foreground/Text) -->
            <SolidColorBrush x:Key="TabItem_TextBrush_Unselected" Color="#4971A3" />
            <SolidColorBrush x:Key="TabItem_TextBrush_Disabled" Color="#888" />
            <SolidColorBrush x:Key="TabItem_TextBrush_Hover" Color="Indigo" />
            <SolidColorBrush x:Key="TabItem_TextBrush_Selected" Color="DarkBlue" />

            <!-- Brushes used for styling TabItems (Borders) -->
            <!-- 
         For all borders around the TabItems, we'll have to use either the 
         identical color OR (what's being done here) we'll have to assure the
         bottom of the border will always result in the color that is being
         used for drawing the line between the TabControl and the TabItemPanel.
      
         If we do use a different (solid) color here, the bottom line will not
         be rendered as desired which I presume is a matter of precedence in the
         way borders are being drawn (anti-clockwise, starting with bottom and
         finishing with left, hence the effect of the left and right edges of 
         the bottom line being drawn with the left and right border respectively).
         If you want to try it out, exchange the LinearGradientBrush with the
         SolidColorBrush that has been commented out and run the app.
         You'll probably have to zoom in to see the effect. 
      -->
            <!--<SolidColorBrush x:Key="TabItem_DisabledBorderBrush" Color="#CCC" />-->
            <LinearGradientBrush x:Key="TabItem_DisabledBorderBrush" 
                           StartPoint="0,0" EndPoint="0,1">
                <GradientStop Color="#CCC" Offset="0"/>
                <GradientStop Color="{StaticResource BorderColor_Base}" 
                       Offset="0.8"/>
            </LinearGradientBrush>
            <SolidColorBrush x:Key="TabItem_BorderBrush_Selected" 
                       Color="{StaticResource BorderColor_Base}" />
            <!-- See the comment regarding the TabItem_DisabledBorderBrush above. -->
            <LinearGradientBrush x:Key="TabItem_Border_Unselected" 
                           StartPoint="0,0" EndPoint="0,1">
                <GradientStop Color="#AAA" Offset="0"/>
                <GradientStop Color="{StaticResource BorderColor_Base}" 
                       Offset="0.8"/>
            </LinearGradientBrush>
            <LinearGradientBrush x:Key="TabItem_HoverBorderBrush" StartPoint="0,0" 
                           EndPoint="0,1">
                <LinearGradientBrush.GradientStops>
                    <GradientStop Offset="0.98" Color="DarkOrange"/>
                    <!-- See the TabItemPanel_BackgroundBrush comment. -->
                    <GradientStop Offset="0.99" 
                          Color="{StaticResource BorderColor_Base}"/>
                </LinearGradientBrush.GradientStops>
            </LinearGradientBrush>

            <!-- 
         Margins for TabItems - these will be set in the respective triggers.
      -->
            <Thickness x:Key="TabItemMargin_Base">0,8,-4,0</Thickness>
            <Thickness x:Key="TabItemMargin_Selected">-4,0,-4,0</Thickness>
            <Thickness x:Key="TabItemMargin_Hover">0,4,-4,0</Thickness>
            <Thickness x:Key="TabItemPanel_Padding">4,0,0,0</Thickness>

            <!--
         The Geometries below will be used to render the ScrollViewer's LineLeft-,
         LineRight- and TabMenu-buttons.
      -->
            <Geometry x:Key="ArrowLeft">M0,5 L10,10 10,0Z</Geometry>
            <Geometry x:Key="ArrowRight">M0,0 L10,5 L0,10Z</Geometry>
            <Geometry x:Key="TabMenuButton">M0,1 H0,5 M7,8 L0,8 0,2 10,2 L10,5 M10,8 L10,10 8,10Z</Geometry>

            <!-- 
         Definitions for the Path-Geometries that are being used to render
         the ScrollViewer's LineButtons.
      -->
            <Path x:Key="ArrowLeftPath"
            Margin="4,3"
            Data="{StaticResource ArrowLeft}"
            Stroke="{StaticResource LineButtonBrush}" 
            Fill="{StaticResource LineButtonBrush}"
            Stretch="Fill"
            VerticalAlignment="Center"
            HorizontalAlignment="Center"/>
            <Path x:Key="ArrowRightPath"
            Margin="4,3"
            Data="{StaticResource ArrowRight}"
            Stroke="{StaticResource LineButtonBrush}" 
            Fill="{StaticResource LineButtonBrush}"
            Stretch="Fill"
            VerticalAlignment="Center"
            HorizontalAlignment="Center"/>
            <Path x:Key="TabMenuButtonPath"
            Margin="2"
            Data="{StaticResource TabMenuButton}"
            Stroke="{StaticResource LineButtonBrush}" 
            Fill="{StaticResource TabMenuButtonBrush}"
            Stretch="Fill"
            VerticalAlignment="Center"
            HorizontalAlignment="Center"/>

            <!-- 
         This determines how wide/high the LineButtons and the TabMenu button 
         will be rendered.
      -->
            <sys:Double x:Key="ButtonWidthAndHeight">16</sys:Double>

            <!-- Styles for the LineButtons -->
            <Style x:Key="LineButtonStyle" TargetType="{x:Type RepeatButton}">
                <Setter Property="Focusable" Value="False"/>
                <Setter Property="Height" Value="{StaticResource ButtonWidthAndHeight}"/>
                <Setter Property="Width" Value="{StaticResource ButtonWidthAndHeight}"/>
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type RepeatButton}">
                            <Border Name="ButtonBorder" Margin="1"
                          BorderBrush="{StaticResource LineButtonBorderBrush}" 
                          Background="{StaticResource LineButtonBackgroundBrush}" 
                          CornerRadius="1" 
                          BorderThickness="1">
                                <ContentPresenter HorizontalAlignment="Stretch"
                                       VerticalAlignment="Stretch"/>
                            </Border>
                            <ControlTemplate.Triggers>
                                <Trigger Property="IsMouseOver" Value="true">
                                    <Setter TargetName="ButtonBorder" Property="Background" 
                                Value="{StaticResource LineButtonHoverBrush}" />
                                </Trigger>
                                <Trigger Property="IsPressed" Value="true">
                                    <Setter TargetName="ButtonBorder" Property="Background" 
                                Value="{StaticResource LineButtonPressedBrush}" />
                                </Trigger>
                                <Trigger Property="IsEnabled" Value="False">
                                    <Setter TargetName="ButtonBorder" Property="Background" 
                                Value="{StaticResource LineButtonDisabledBrush}" />
                                    <Setter TargetName="ButtonBorder" Property="Opacity" 
                                Value="0.4"/>
                                </Trigger>
                            </ControlTemplate.Triggers>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>

            <!-- 
         The style for the MenuItem that represents the clickable portion
         for opening the sub-menu that itself will contain the list of
         TabItems.         
      -->
            <Style x:Key="TabMenuButtonStyle" TargetType="{x:Type MenuItem}">
                <Setter Property="Focusable" Value="False"/>
                <Setter Property="Height" Value="{StaticResource ButtonWidthAndHeight}"/>
                <Setter Property="Width" Value="{StaticResource ButtonWidthAndHeight}"/>
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type MenuItem}">
                            <Border Name="ButtonBorder" Margin="1" 
                          BorderBrush="{StaticResource LineButtonBorderBrush}" 
                          Background="{StaticResource LineButtonBackgroundBrush}" 
                          CornerRadius="1" 
                          BorderThickness="1">
                                <Grid>
                                    <ContentPresenter ContentSource="Header" 
                                          Content="{StaticResource TabMenuButtonPath}"
                                          HorizontalAlignment="Stretch"
                                          VerticalAlignment="Stretch"/>
                                    <Popup Name="Popup"
                               Placement="Bottom"
                               IsOpen="{TemplateBinding IsSubmenuOpen}"
                               AllowsTransparency="True" 
                               Focusable="False"
                               PopupAnimation="Fade">
                                        <!-- 
                              Since we override the ControlTemplate, we're also responsible
                              for drawing stuff like the shadow around the popup-menu.
                              
                              Here, I'll use a Chrome that's provided in the Aero assembly. 
                              Note that, in order to use this (that is, the namespace defined
                              at the very top of this window), a reference to 
                              PresentationFramework.Aero is required.
                           -->
                                        <!--<Ribbon:SystemDropShadowChrome Color="#71000000" 
                                                       CornerRadius="1"
                                                       Margin="0,0,8,8"
                                                       SnapsToDevicePixels="True">
                                            <Border Name="SubmenuBorder"
                                   Margin="1"
                                   SnapsToDevicePixels="True"
                                   BorderBrush="{StaticResource LineButtonBorderBrush}" 
                                   Background="{StaticResource TabItemMenuBackcolor}" 
                                   CornerRadius="1" 
                                   BorderThickness="1">
                                                <StackPanel 
                                    IsItemsHost="True" 
                                    KeyboardNavigation.DirectionalNavigation="Cycle" />
                                            </Border>
                                        </mwt:SystemDropShadowChrome>-->
                                    </Popup>
                                </Grid>
                            </Border>
                            <ControlTemplate.Triggers>
                                <Trigger Property="IsHighlighted" Value="true">
                                    <Setter TargetName="ButtonBorder" Property="Background" 
                                Value="{StaticResource LineButtonHoverBrush}" />
                                </Trigger>
                            </ControlTemplate.Triggers>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>

            <SolidColorBrush x:Key="MenuItem_ForegroundBrush"
                       Color="#333"/>
            <SolidColorBrush x:Key="MenuItem_DisabledForegroundBrush" 
                       Color="#AAA"/>
            <SolidColorBrush x:Key="MenuItem_DisabledBackgroundBrush" 
                       Color="#1555"/>

            <!-- The style for MenuItems that represent TabItems -->
            <Style x:Key="TabMenuItem" TargetType="{x:Type MenuItem}">
                <!-- 
            In order to not further pollute the sample with more
            ControlTemplates, I'll stick with simply overriding
            the HilightBrushKey for the hovered MenuItem.
            Poor man's Style. :-)
         -->
                <Style.Resources>
                    <LinearGradientBrush    
                  x:Key="{x:Static SystemColors.HighlightBrushKey}"
                  StartPoint="0.5,0" EndPoint="0.5,1">
                        <GradientStop Color="#FFFFD5A0" Offset="0.3"/>
                        <GradientStop Color="#FFEFA335" Offset="0.51"/>
                        <GradientStop Color="#FFFFC14A" Offset="0.986"/>
                    </LinearGradientBrush>
                </Style.Resources>

                <!-- This will help us bind to the Header of a TabItem -->
                <Setter Property="Header" Value="{Binding Path=Header}" />
                <!-- 
            In order for MenuItems to support the IsEnabled state of a TabItem,
            we simply bind the IsEnabled property of the MenuItem to that of the
            TabItem.
            This way, a disabled TabItem will not be selectable via the Menu.
         -->
                <Setter Property="IsEnabled" Value="{Binding Path=IsEnabled}" />
                <!-- 
            By making the MenuItems checkable AND binding the IsChecked
            property to the IsSelected property of the TabItems, we'll 
            efficiently allow to pick the selected TabItem from the Menu
            with a simple two-way binding.
         -->
                <Setter Property="IsCheckable" Value="{Binding Path=IsEnabled}" />
                <Setter Property="IsChecked" Value="{Binding Path=IsSelected, Mode=TwoWay}" />
                <Setter Property="Foreground" Value="{StaticResource MenuItem_ForegroundBrush}"/>
                <Style.Triggers>
                    <Trigger Property="IsHighlighted" Value="True">
                        <Setter Property="Foreground"
                       Value="{StaticResource TabItem_TextBrush_Selected}"/>
                    </Trigger>
                    <Trigger Property="IsEnabled" Value="False">
                        <Setter Property="Foreground" 
                       Value="{StaticResource MenuItem_DisabledForegroundBrush}"/>
                        <Setter Property="Background"
                                Value="{StaticResource MenuItem_DisabledBackgroundBrush}"/>
                    </Trigger>
                    <!-- Provide a hover-appearance for disabled MenuItems -->
                    <!-- 
               This won't work due to the fact that disabled items neither receive
               IsHighlighted nor IsMouseOver ... I'll leave this for now. 
            <MultiTrigger>
               <MultiTrigger.Conditions>
                  <Condition SourceName="Border" Property="IsMouseOver" Value="True"/>
                  <Condition Property="IsEnabled" Value="False"/>
               </MultiTrigger.Conditions>
               <Setter Property="Background"
                                Value="{StaticResource MenuItem_DisabledBackgroundBrush}"/>
            </MultiTrigger>
            -->
                </Style.Triggers>
            </Style>

            <!-- The TabControl's Style. -->
            <Style TargetType="{x:Type TabControl}">
                <Setter Property="SnapsToDevicePixels" Value="true"/>
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="TabControl">
                            <Grid>
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="Auto"/>
                                    <RowDefinition Height="*"/>
                                </Grid.RowDefinitions>

                                <!-- 
                        The Border around each TabItem will allow us to draw the line
                        between the TabItemPanel and the TabControl (resp. the 
                        TabPage-container) when a TabItem is NOT selected, which 
                        replaces the bottom line of the TabItemPanel's border. 
                        Thus, we'll avoid drawing the bottom line for the selected
                        TabItem. Also, since the TabItem, when selected, applies a left
                        Margin of 4px, we need to add these here as Padding.
                     -->
                                <Border Background="{StaticResource TabItemPanel_BackgroundBrush}" 
                             Padding="{StaticResource TabItemPanel_Padding}">
                                    <!-- This is the area in which TabItems (the strips) will be drawn. -->
                                    <TabPanel IsItemsHost="True" />
                                </Border>

                                <!-- 
                        This is the outer border of the TabControl itself, actually meaning
                        the Panel that will host a TabItem's content.
                        The top-border here will not be drawn as, otherwise, the TabItemPanel
                        would always show a thin line for the selected Tab (which we want 
                        to avoid).
                     -->
                                <Border BorderThickness="1,0,1,1" 
                             Grid.Row="1" 
                             BorderBrush="{StaticResource TabItem_BorderBrush_Selected}" 
                             Background="{StaticResource TabControl_BackgroundBrush_Base}">
                                    <!-- This is the first/outer Border drawn on the TabPage -->
                                    <Border BorderThickness="1" 
                                BorderBrush="{StaticResource TabPage_InnerBorderBrushDark}" 
                                CornerRadius="3" 
                                Margin="8">
                                        <!-- 
                              This is the second/inner Border drawn on the TabPage. 
                              This Border is drawn with a horizontal Gradient that is transparent
                              on the left which produces the fading effect.
                           -->
                                        <Border BorderThickness="1" 
                                   BorderBrush="{StaticResource TabPage_InnerBorderBrushBright}" 
                                   CornerRadius="2" 
                                   Margin="0" 
                                   Padding="2,2,3,3"
                                   >
                                            <!-- 
                                 This is where the Content of the selected TabPage 
                                 will be rendered. 
                              -->
                                            <ContentPresenter ContentSource="SelectedContent" Margin="0"/>
                                        </Border>
                                    </Border>
                                </Border>
                            </Grid>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>

            <!-- The Style for TabItems (strips). -->
            <Style TargetType="{x:Type TabItem}">
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type TabItem}">
                            <!-- The Grid helps defining the general height of TabItems. -->
                            <Grid Height="35" VerticalAlignment="Bottom">
                                <!-- 
                        The important aspect here is that the bottom of the Border is 0px thick,
                        helping the TabItem/strip to blend into the TabPage.

                     -->
                                <Border Name="Border"
                             Background="{StaticResource TabItem_BackgroundBrush_Unselected}"
                             BorderBrush="{StaticResource TabItem_BorderBrush_Selected}" 
                             Margin="{StaticResource TabItemMargin_Selected}" 
                             BorderThickness="2,1,1,0" 
                             CornerRadius="3,3,0,0" 
                             >
                                    <!-- This is where the Content of the TabItem will be rendered. -->
                                    <ContentPresenter x:Name="ContentSite"
                                          VerticalAlignment="Center"
                                          HorizontalAlignment="Center"
                                          ContentSource="Header"
                                          Margin="7,2,12,2"
                                          RecognizesAccessKey="True"/>
                                </Border>
                            </Grid>
                            <ControlTemplate.Triggers>
                                <!-- The appearance of a TabItem when it's inactive/unselected -->
                                <Trigger Property="IsSelected" Value="False">
                                    <Setter Property="Panel.ZIndex" Value="90" />
                                    <Setter TargetName="Border" Property="BorderBrush" 
                                Value="{StaticResource TabItem_Border_Unselected}" />
                                    <Setter Property="Foreground" 
                                Value="{StaticResource TabItem_TextBrush_Unselected}" />
                                    <!-- Except for the selected TabItem, tabs are to appear smaller in height. -->
                                    <Setter TargetName="Border" Property="Margin" 
                                Value="{StaticResource TabItemMargin_Base}"/>
                                </Trigger>

                                <!-- 
                        The appearance of a TabItem when it's disabled 
                        (in addition to Selected=False)
                     -->
                                <Trigger Property="IsEnabled" Value="False">
                                    <Setter Property="Panel.ZIndex" Value="80" />
                                    <Setter TargetName="Border" Property="BorderBrush"
                                Value="{StaticResource TabItem_DisabledBorderBrush}" />
                                    <Setter TargetName="Border" Property="Background" 
                                Value="{StaticResource TabItem_BackgroundBrush_Disabled}" />
                                    <Setter Property="Foreground" 
                                Value="{StaticResource TabItem_TextBrush_Disabled}" />
                                </Trigger>

                                <!-- The appearance of a TabItem when the mouse hovers over it -->
                                <MultiTrigger>
                                    <MultiTrigger.Conditions>
                                        <Condition Property="Border.IsMouseOver" Value="True"/>
                                        <Condition Property="IsSelected" Value="False"/>
                                    </MultiTrigger.Conditions>
                                    <Setter Property="Panel.ZIndex" Value="99" />
                                    <Setter Property="Foreground" Value="{StaticResource TabItem_TextBrush_Hover}" />
                                    <Setter Property="BorderBrush" 
                                TargetName="Border" 
                                Value="{StaticResource TabItem_HoverBorderBrush}" />
                                    <Setter TargetName="Border" Property="BorderThickness" Value="2,1,1,1" />
                                    <Setter Property="Background" TargetName="Border"
                                Value="{StaticResource TabItem_HoverBackgroundBrush}"/>
                                    <!-- 
                           To further increase the hover-effect, extend the TabItem's height a little
                           more compared to unselected TabItems.
                        -->
                                    <Setter TargetName="Border" Property="Margin" 
                                Value="{StaticResource TabItemMargin_Hover}"/>
                                </MultiTrigger>

                                <!-- The appearance of a TabItem when it's active/selected -->
                                <Trigger Property="IsSelected" Value="True">
                                    <!-- We want the selected TabItem to always be on top. -->
                                    <Setter Property="Panel.ZIndex" Value="100" />
                                    <Setter TargetName="Border" Property="BorderBrush" 
                                Value="{StaticResource TabItem_BorderBrush_Selected}" />
                                    <Setter TargetName="Border" Property="Background" 
                                Value="{StaticResource TabItem_BackgroundBrush_Selected}" />
                                    <Setter TargetName="Border" Property="BorderThickness" Value="1,1,1,0" />
                                    <Setter Property="Foreground" 
                                Value="{StaticResource TabItem_TextBrush_Selected}"/>
                                    <Setter TargetName="Border" Property="Margin" 
                                Value="{StaticResource TabItemMargin_Selected}"/>
                                </Trigger>
                            </ControlTemplate.Triggers>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>

            <Ribbon:RibbonCommand  x:Key="Employee_EmployeeInformationRes"
                           Executed="Employee_EmployeeInformation_Executed"
                           LabelTitle="Permanent"
                           ToolTipTitle="Permanent Employee Information"
                           SmallImageSource="images/Emp_Image.png"
                           LargeImageSource="images/Emp_Image.png"
                           ToolTipDescription="Manage Permanent Employee Information" />
            <Ribbon:RibbonCommand  x:Key="Employee_TempEmployeeInformationRes"
                           Executed="Employee_TempEmployeeInformation_Executed"
                           LabelTitle="Temporary"
                           ToolTipTitle="Temporary Employee Information"
                           SmallImageSource="images/TempEmp.png"
                           LargeImageSource="images/TempEmp.png"
                           ToolTipDescription="Manage Temporary Employee Information" />
            <Ribbon:RibbonCommand  x:Key="Employee_SearchEmployeeInformationRes"
                           Executed="Employee_SearchEmployeeInformation_Executed"
                           LabelTitle="Search/Edit"
                           ToolTipTitle="Search or Edit Employee Information"
                           SmallImageSource="images/SearchEmp.png"
                           LargeImageSource="images/SearchEmp.png"
                           ToolTipDescription="Manage searching and Editing Employee Information" />
            <Ribbon:RibbonCommand  x:Key="Organisation_SectionManagementRes"
                           Executed="Organisation_SectionManagement_Executed"
                           LabelTitle="Section"
                           ToolTipTitle="Section Information"
                           SmallImageSource="images/DiffrentSections.png"
                           LargeImageSource="images/DiffrentSections.png"
                           ToolTipDescription="Manage Sections" />
            <Ribbon:RibbonCommand  x:Key="Organisation_TaskManagementRes"
                           Executed="Organisation_TaskManagement_Executed"
                           LabelTitle="Task"
                           ToolTipTitle="Task Management"
                           SmallImageSource="images/TaskNotes.png"
                           LargeImageSource="images/TaskNotes.png"
                           ToolTipDescription="Manage Tasks" />
            <Ribbon:RibbonCommand  x:Key="Organisation_EmployeeTaskMappingRes"
                           Executed="Organisation_EmployeeTaskMapping_Executed"
                           LabelTitle="EmployeeTask"
                           ToolTipTitle="Employee Task Mapping"
                           SmallImageSource="images/EmpTask.png"
                           LargeImageSource="images/EmpTask.png"
                           ToolTipDescription="Manage Employee Tasks" />
            <Ribbon:RibbonCommand  x:Key="Organisation_EmployeeAttendenceRes"
                           Executed="Organisation_EmployeeAttendence_Executed"
                           LabelTitle="Employee Attendence"
                           ToolTipTitle="Employee Attendence"
                           SmallImageSource="images/EmpAttendence.png"
                           LargeImageSource="images/EmpAttendence.png"
                           ToolTipDescription="Manage Employee Attendence" />
            <Ribbon:RibbonCommand  x:Key="Organisation_EmployeeAttendenceReportRes"
                           Executed="Organisation_EmployeeAttendenceReport_Executed"
                           LabelTitle="Employee Attendence Report"
                           ToolTipTitle="Employee Attendence report"
                           SmallImageSource="images/AttendenceReport.png"
                           LargeImageSource="images/AttendenceReport.png"
                           ToolTipDescription="Manage Employee Attendence" />
            
        </ResourceDictionary>
    </Window.Resources>
    <Grid x:Name="LayOutGrid" Background="#FFD9E9F5">
        <Ribbon:Ribbon Title="AbhiRuchiFoods - Features" x:Name="MainUIRibbon">

            <Ribbon:Ribbon.ApplicationMenu>
                <Ribbon:RibbonApplicationMenu Name="AppMenu">
                    <Ribbon:RibbonApplicationMenu.Command>
                        <Ribbon:RibbonCommand LabelTitle="Abhiruchi" LargeImageSource="Images\UserInfo.png" />
                    </Ribbon:RibbonApplicationMenu.Command>
                </Ribbon:RibbonApplicationMenu>
            </Ribbon:Ribbon.ApplicationMenu>

            <Ribbon:RibbonTab x:Name="tabHRM" Label="HRM" >
                <Ribbon:RibbonGroup Name="EmployeeManagement">
                    <Ribbon:RibbonGroup.Command>
                        <Ribbon:RibbonCommand LabelTitle="Employee Management"></Ribbon:RibbonCommand>
                    </Ribbon:RibbonGroup.Command>
                    <Ribbon:RibbonButton Command="{StaticResource Employee_EmployeeInformationRes}" />
                    <Ribbon:RibbonButton Command="{StaticResource Employee_TempEmployeeInformationRes}" />
                    <Ribbon:RibbonButton Command="{StaticResource Employee_SearchEmployeeInformationRes}" />
                </Ribbon:RibbonGroup>
            </Ribbon:RibbonTab>

            <Ribbon:RibbonTab x:Name="tabOrganisation" Label="Organisation" >
                <Ribbon:RibbonGroup Name="SectionManagement">
                    <Ribbon:RibbonGroup.Command>
                        <Ribbon:RibbonCommand LabelTitle="Section Management"></Ribbon:RibbonCommand>
                    </Ribbon:RibbonGroup.Command>
                    <Ribbon:RibbonButton Command="{StaticResource Organisation_SectionManagementRes}" />
                    <Ribbon:RibbonButton Command="{StaticResource Organisation_TaskManagementRes}" />
                    <Ribbon:RibbonButton Command="{StaticResource Organisation_EmployeeTaskMappingRes}" />
                    <Ribbon:RibbonButton Command="{StaticResource Organisation_EmployeeAttendenceRes}" />
                    <Ribbon:RibbonButton Command="{StaticResource Organisation_EmployeeAttendenceReportRes}" />
                </Ribbon:RibbonGroup>
            </Ribbon:RibbonTab>



        </Ribbon:Ribbon>

        <TabControl HorizontalAlignment="Stretch" Margin="12,148,0,0" SelectionChanged="tabMainLayout_SelectionChanged" Name="tabMainLayout" Template="{DynamicResource TabControlControlTemplate1}" IsSynchronizedWithCurrentItem="True" VerticalAlignment="Stretch" Width="Auto" Height="Auto" Background="#FFD9E9F5">
            <TabControl.Resources>
                <Style x:Key="TabScrollerRepeatButtonStyle" TargetType="{x:Type RepeatButton}">
                    <Setter Property="Template">
                        <Setter.Value>
                            <ControlTemplate>
                                <Border Background="#58B5EA">
                                    <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" Content="{TemplateBinding ContentControl.Content}"/>
                                </Border>
                            </ControlTemplate>
                        </Setter.Value>
                    </Setter>
                </Style>

                <ControlTemplate x:Key="TabControlControlTemplate1" TargetType="{x:Type TabControl}">
                    <Grid x:Name="Grid" KeyboardNavigation.TabNavigation="Local">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition x:Name="ColumnDefinition0"/>
                            <ColumnDefinition x:Name="ColumnDefinition1" Width="0"/>
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition x:Name="RowDefinition0" Height="Auto"/>
                            <RowDefinition x:Name="RowDefinition1" Height="*"/>
                        </Grid.RowDefinitions>
                        <Border Grid.Row="1" Grid.Column="0" x:Name="ContentPanel" BorderBrush="#FFD9E9F5" BorderThickness="0,0,1,1" KeyboardNavigation.TabIndex="2" KeyboardNavigation.TabNavigation="Local" KeyboardNavigation.DirectionalNavigation="Contained">
                            <Border x:Name="Border" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}">
                                <Border Background="{TemplateBinding Background}" x:Name="Border1">
                                    <ContentPresenter DataContext="{x:Null}" Margin="{TemplateBinding Padding}" x:Name="PART_SelectedContentHost" Content="{TemplateBinding SelectedContent}" ContentTemplate="{TemplateBinding SelectedContentTemplate}" ContentTemplateSelector="{TemplateBinding SelectedContentTemplateSelector}" ContentSource="SelectedContent"/>
                                </Border>
                            </Border>
                        </Border>
                        <ScrollViewer x:Name="HeaderPanel" Grid.Row="0" Grid.Column="0" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="0,0,0,0" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Disabled">
                            <ScrollViewer.Style>
                                <Style TargetType="{x:Type ScrollViewer}">
                                    <Setter Property="Template">
                                        <Setter.Value>
                                            <ControlTemplate>
                                                <Grid Margin="0,0,0,0" Grid.Row="0" Grid.Column="0" x:Name="HeaderPanel">
                                                    <Grid.ColumnDefinitions>
                                                        <ColumnDefinition Width="25"/>
                                                        <ColumnDefinition Width="*"/>
                                                        <ColumnDefinition Width="25"/>
                                                    </Grid.ColumnDefinitions>
                                                    <Grid.RowDefinitions>
                                                        <RowDefinition Height="Auto"/>
                                                    </Grid.RowDefinitions>
                                                    <RepeatButton Grid.Column="0" Content="&lt;" Command="ScrollBar.LineLeftCommand" Style="{DynamicResource TabScrollerRepeatButtonStyle}" BorderThickness="2" />
                                                    <ScrollContentPresenter Grid.Column="1" Content="{TemplateBinding ScrollViewer.Content}" />
                                                    <RepeatButton Grid.Column="2" Content="&gt;" Command="ScrollBar.LineRightCommand" Style="{DynamicResource TabScrollerRepeatButtonStyle}"/>
                                                </Grid>
                                            </ControlTemplate>
                                        </Setter.Value>
                                    </Setter>
                                </Style>
                            </ScrollViewer.Style>
                            <StackPanel IsItemsHost="true" Orientation="Horizontal" Background="{x:Null}" KeyboardNavigation.TabIndex="1" />
                        </ScrollViewer>
                    </Grid>
                </ControlTemplate>
            </TabControl.Resources>
            <TabControl.Style>
                <Style>
                    <EventSetter Event="Button.Click" Handler="TabItemClose_Click"></EventSetter>
                </Style>
            </TabControl.Style>
            <TabControl.ItemContainerStyle>
                <Style TargetType="TabItem">
                    <Setter Property="HeaderTemplate">
                        <Setter.Value>
                            <DataTemplate>
                                <StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
                                    <!--<Image Height="16" Source="Images\Organizer.png" HorizontalAlignment="Left" />-->
                                    <ContentPresenter HorizontalAlignment="Right" VerticalAlignment="Center" Content="{Binding}"></ContentPresenter>
                                    <Button x:Name="cmbCloseTab">
                                        <Image ToolTip="Close tab" Source="Images\Close.png" Height="10" Width="10" />
                                    </Button>
                                </StackPanel>
                            </DataTemplate>
                        </Setter.Value>
                    </Setter>
                    <Setter Property="Template">
                        <Setter.Value>
                            <ControlTemplate TargetType="{x:Type TabItem}">
                                <!-- The Grid helps defining the general height of TabItems. -->
                                <Grid Height="35" VerticalAlignment="Bottom">
                                    <!-- 
                        The important aspect here is that the bottom of the Border is 0px thick,
                        helping the TabItem/strip to blend into the TabPage.

                     -->
                                    <Border Name="Border"
                             Background="{StaticResource TabItem_BackgroundBrush_Unselected}"
                             BorderBrush="{StaticResource TabItem_BorderBrush_Selected}" 
                             Margin="{StaticResource TabItemMargin_Selected}" 
                             BorderThickness="2,1,1,0" 
                             CornerRadius="3,3,0,0" 
                             >
                                        <!-- This is where the Content of the TabItem will be rendered. -->
                                        <ContentPresenter x:Name="ContentSite"
                                          VerticalAlignment="Center"
                                          HorizontalAlignment="Center"
                                          ContentSource="Header"
                                          Margin="7,2,12,2"
                                          RecognizesAccessKey="True"/>
                                    </Border>
                                </Grid>
                                <ControlTemplate.Triggers>
                                    <!-- The appearance of a TabItem when it's inactive/unselected -->
                                    <Trigger Property="IsSelected" Value="False">
                                        <Setter Property="Panel.ZIndex" Value="90" />
                                        <Setter TargetName="Border" Property="BorderBrush" 
                                Value="{StaticResource TabItem_Border_Unselected}" />
                                        <Setter Property="Foreground" 
                                Value="{StaticResource TabItem_TextBrush_Unselected}" />
                                        <!-- Except for the selected TabItem, tabs are to appear smaller in height. -->
                                        <Setter TargetName="Border" Property="Margin" 
                                Value="{StaticResource TabItemMargin_Base}"/>
                                    </Trigger>

                                    <!-- 
                        The appearance of a TabItem when it's disabled 
                        (in addition to Selected=False)
                     -->
                                    <Trigger Property="IsEnabled" Value="False">
                                        <Setter Property="Panel.ZIndex" Value="80" />
                                        <Setter TargetName="Border" Property="BorderBrush"
                                Value="{StaticResource TabItem_DisabledBorderBrush}" />
                                        <Setter TargetName="Border" Property="Background" 
                                Value="{StaticResource TabItem_BackgroundBrush_Disabled}" />
                                        <Setter Property="Foreground" 
                                Value="{StaticResource TabItem_TextBrush_Disabled}" />
                                    </Trigger>

                                    <!-- The appearance of a TabItem when the mouse hovers over it -->
                                    <MultiTrigger>
                                        <MultiTrigger.Conditions>
                                            <Condition Property="Border.IsMouseOver" Value="True"/>
                                            <Condition Property="IsSelected" Value="False"/>
                                        </MultiTrigger.Conditions>
                                        <Setter Property="Panel.ZIndex" Value="99" />
                                        <Setter Property="Foreground" Value="{StaticResource TabItem_TextBrush_Hover}" />
                                        <Setter Property="BorderBrush" 
                                TargetName="Border" 
                                Value="{StaticResource TabItem_HoverBorderBrush}" />
                                        <Setter TargetName="Border" Property="BorderThickness" Value="2,1,1,1" />
                                        <Setter Property="Background" TargetName="Border"
                                Value="{StaticResource TabItem_HoverBackgroundBrush}"/>
                                        <!-- 
                           To further increase the hover-effect, extend the TabItem's height a little
                           more compared to unselected TabItems.
                        -->
                                        <Setter TargetName="Border" Property="Margin" 
                                Value="{StaticResource TabItemMargin_Hover}"/>
                                    </MultiTrigger>

                                    <!-- The appearance of a TabItem when it's active/selected -->
                                    <Trigger Property="IsSelected" Value="True">
                                        <!-- We want the selected TabItem to always be on top. -->
                                        <Setter Property="Panel.ZIndex" Value="100" />
                                        <Setter TargetName="Border" Property="BorderBrush" 
                                Value="{StaticResource TabItem_BorderBrush_Selected}" />
                                        <Setter TargetName="Border" Property="Background" 
                                Value="{StaticResource TabItem_BackgroundBrush_Selected}" />
                                        <Setter TargetName="Border" Property="BorderThickness" Value="1,1,1,0" />
                                        <Setter Property="Foreground" 
                                Value="{StaticResource TabItem_TextBrush_Selected}"/>
                                        <Setter TargetName="Border" Property="Margin" 
                                Value="{StaticResource TabItemMargin_Selected}"/>
                                    </Trigger>
                                </ControlTemplate.Triggers>
                            </ControlTemplate>
                        </Setter.Value>
                    </Setter>
                </Style>
            </TabControl.ItemContainerStyle>

            <!--<TabItem Header="Home    " Name="tabDefault" VerticalAlignment="Top">
                <Grid />
            </TabItem>-->
        </TabControl>

        <!--<telerik:RadTabControl HorizontalAlignment="Stretch" Margin="31,146,12,12" Name="radTabControl1" VerticalAlignment="Stretch">
            <telerik:RadTabItem Header="RadTabItem" Height="16" HorizontalAlignment="Left" Name="RadTabItem0" VerticalAlignment="Top" Width="120" />
            <telerik:RadTabItem Header="RadTabItem" Height="16" HorizontalAlignment="Left" Name="RadTabItem1" VerticalAlignment="Top" Width="120" />
            <telerik:RadTabItem Header="RadTabItem" Height="16" HorizontalAlignment="Left" Name="RadTabItem2" VerticalAlignment="Top" Width="120" />
        </telerik:RadTabControl>-->
        <!--<Grid Name="grdMainLayout" Height="828" HorizontalAlignment="Left" Margin="12,143,0,0" VerticalAlignment="Top" Width="1600">
            
        </Grid>-->
    </Grid>
</Window>
